package com.binarycube.webserver.datasource;

import java.util.List;

import com.binarycube.webserver.config.DatasourceConfig;

/**
 * The generic interface for datasources.
 * Each implementation of the datasource will interpret the identifier in the respective context.
 * eg, for a JDBC datasource, the identifier would be the key, for XML an XPath, and CSV, a row number.
 * @author chris
 *
 */

public interface IDataSource {
	/**
	 * Clear any parameters that might have been set, and establish the defaults
	 */
	public void resetParams();
	
	/**
	 * Perform the query on the datasource using the set parameters.
	 * @return
	 */
	public List<Record> doQuery();
	/**
	 * Set a parameter on the datasource prior to querying
	 * @param name
	 * @param value
	 * @return
	 */
	public IDataSource setParam(String name, String value);
	
	/**
	 * Used to initialise the datasource when first loaded
	 * @param config
	 */
	public void configure(DatasourceConfig config);
}
